name: Changelog check
on: [pull_request_target]

jobs:
  changelog-check:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
    steps:
      - uses: actions/checkout@v4
      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version-file: 'tools/go.mod'
      - run: make tools
      - run: go run cmd/changelog-check/main.go ${{ github.event.pull_request.number }}
        working-directory: ./tools
        env:
          GITHUB_OWNER: cloudflare
          GITHUB_REPO: terraform-provider-cloudflare
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
